package com.hx.controller;

import com.hx.poji.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

@Controller
public class Controller05 {

    /**
     *
     * @param id
     * @return
     */
    @RequestMapping("/test12")
    public String test12(Integer id) {
        if (id>10){
            throw new RuntimeException("id>10了");
        }else if (id<0){
            throw new IllegalArgumentException("id<0");
        }
        return "success";
    }

    /**
     * value 表示映射请求url 功能跟path一样
     * method ： 限定请求方式【get， post，put，delete】 请求方式不对 会出现405
     * @param id
     * @return
     */
    @RequestMapping(path = {"/test13"},method = RequestMethod.POST)
    public String test13(Integer id) {
        System.out.println("id="+id);
        return "success";

    }
}
